<?php ob_start() ?>

<div class="row">
    <?php if (isset($_SESSION['adminbetporra_msj'])) { ?>
        <div class="alert alert-success alert-dismissable col-lg-12 text-center">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong><?php echo $_SESSION['adminbetporra_msj'] ?></strong>
        </div>
        <?php
        unset($_SESSION['adminbetporra_msj']);
    }
    ?>
    <div class="col-lg-12">
        <h1>Equipos <small>Datos Equipo</small></h1>
    </div>
</div>
<hr>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-archive"></i> Datos del Equipo</h3>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered table-striped table-hover">
                        <tbody>
                            <tr>
                                <th>Nombre</th>
                                <td><?php echo $param_equipo['nombre'] ?></td>
                            </tr>
                            <tr>
                                <th>País</th>
                                <td><?php echo $param_equipo['pais'] ?></td>
                            </tr>
                            <tr align="center">
                                <td colspan="2"><img src="../betporra/web/images/clubs/<?php echo $param_equipo['escudo'] ?>" title="<?php echo $param_equipo['nombre'] ?>" alt="<?php echo $param_equipo['nombre'] ?>" width="200"/></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <a class="btn btn-primary" href="modificar_equipo/<?php echo $_GET['id']; ?>"><i class="fa fa-edit"></i> Modificar Equipo</a>
        <a class="btn btn-primary" href="eliminar_equipo/<?php echo $_GET['id']; ?>"><i class="fa fa-trash-o"></i> Eliminar Equipo</a>
    </div>
</div>
<hr>
<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-suitcase"></i> Competiciones</h3>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-bordered table-hover table-striped tablesorter" id="dataTables-example">
                <thead>
                    <tr>
                        <th>Nombre <i class="fa fa-sort"></i></th>
                        <th>País <i class="fa fa-sort"></i></th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($params_equipo_competicion as $fila) { ?>
                        <tr>
                            <td><a href="ver_competicion/<?php echo $fila['idcompeticion'] ?>"><?php echo $fila['nombre'] ?></a></td>
                            <td><?php echo $fila['pais'] ?></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<hr>
<button class="btn btn-primary" data-toggle="modal" data-target="#modalnuevacompeticion"><i class="fa fa-edit"></i> Añadir a competicion</button>

<!-- Modal -->
<div class="modal fade" id="modalnuevacompeticion" tabindex="-1" role="dialog" aria-labelledby="modalnuevacompeticion" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <form class="form-horizontal" role="form" action="registro_equipo_competicion/<?php echo $_GET['id']; ?>" method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Añadir a competición</h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        <label for="competicion">Competición:</label>
                        <select name="competicion" class="form-control" >
                            <option value="0">Elige un Competición: </option>
                            <?php
                            foreach ($params_competicion as $fila) {
                                echo '<option value="' . $fila['id'] . '">' . $fila['nombre'] . '</option>';
                            }
                            ?>
                        </select>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                    <input type="submit" class="btn btn-primary" value="Guardar Cambios" id="modalbutton">
                </div>
            </form>
        </div>
    </div>
</div>


<?php
$contenido = ob_get_clean();
include "app/templates/template_admin.php";
?>
